unit uDBFuns;

interface

uses
  DB, uiMemStarAPI;

function DataTypeToMemStarType(ADataType:TFieldType): TMemStarFieldType;

function MemStarTypeToDataType(AType:TMemStarFieldType): TFieldType;

implementation

function DataTypeToMemStarType(ADataType:TFieldType): TMemStarFieldType;
begin
  case ADataType of
    ftString, ftMemo, ftFmtMemo, ftWideString, ftFixedChar
      :Result := msftString;

    ftSmallint, ftInteger, ftWord, ftLargeint
      :Result := msftInteger;

    ftFloat
      :Result := msftFloat;

    ftCurrency
      :Result := msftCurrency;

    ftBoolean
      :Result := msftBoolean;

    ftDate, ftTime, ftDateTime, ftTimeStamp
      :Result := msftDateTime;

  else Result := msftString;
  end;
end;

function MemStarTypeToDataType(AType:TMemStarFieldType): TFieldType;
begin
  case AType of
    msftString  : Result := ftString;
    msftCurrency: Result := ftCurrency;
    msftInteger : Result := ftInteger;
    msftFloat   : Result := ftFloat;
    msftBoolean : Result := ftBoolean;
    msftDateTime: Result := ftDateTime;
  else Result := ftUnknown;
  end;
end;

end.
